﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LiteExpress.Core.DbClient;
using Dapper;

namespace LiteExpress.Demo.Data.Adapters
{
    public class OrganAdapter : IOrganAdapter
    {
        public string DBName = "CoreOrgan";

        public OrganEntity Select(long orgID)
        {
            var org = DbFactory.GetClient(DBName, (conn) =>
            {
                return conn.Query<OrganEntity>("SELECT * FROM Organ WHERE OrgID=@OrgID", new { OrgID = orgID }).SingleOrDefault();
            });

            return org;
        }
    }
}
